package moe.loliserver.entity;

import com.mojang.authlib.GameProfile;
import moe.loliserver.LanguagesMap;
import moe.loliserver.LoliServer;
import moe.loliserver.utils.LoliServerConfigUtil;
import net.minecraftforge.common.util.FakePlayer;
import org.bukkit.craftbukkit.v1_16_R3.CraftServer;
import org.bukkit.craftbukkit.v1_16_R3.entity.CraftPlayer;
import org.bukkit.permissions.Permission;
import static moe.loliserver.LanguagesMap.i18nGet;

public class CraftFakePlayer extends CraftPlayer {

    public CraftFakePlayer(CraftServer server, FakePlayer entity) {
        super(server, entity);
    }

    @Override
    public boolean isOp() {
        GameProfile profile = this.getHandle().getGameProfile();
        return profile != null && profile.getId() != null && super.isOp();
    }

    @Override
    public void setOp(boolean value) {
        LoliServer.LOGGER.warn(i18nGet("fakePlayerWarn"));
    }

    @Override
    public boolean hasPermission(String name) {
        return super.hasPermission(name);
    }

    @Override
    public boolean hasPermission(Permission perm) {
        return super.hasPermission(perm);
    }

    @Override
    public boolean isPermissionSet(String name) {
        return super.hasPermission(name);
    }

    @Override
    public boolean isPermissionSet(Permission perm) {
        return super.hasPermission(perm);
    }

}
